Skip to content

Instantly share code, notes, and snippets.

View hxmwr's full-sized avatar
🐶
Doing machine learning research.

Nmaxwiver hxmwr

🐶
Doing machine learning research.
  • H.E. Tech
  • China
View GitHub Profile
@hxmwr
hxmwr / diamond.c
Last active May 3, 2020 12:57
print diamond pattern
#include <stdio.h>
int main()
{
char *str = " ************";
for (int i = 0 i < 20; i++) printf("%.*s\n", i/4%2==0?i % 4 + 5:9-i%4, i/4%2==0?str + i % 4:str+4-i%4);
return 0;
}
@hxmwr
hxmwr / package.json
Created April 10, 2019 02:52
SPA auto reload javascript and scss
{
"name": "datepicker",
"version": "1.0.0",
"description": "another datepicker",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack",
"dev": "webpack-dev-server"
},
@hxmwr
hxmwr / traverse_dir.c
Created March 16, 2019 06:48
C traverse directory with callback
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <sys/dir.h>
#include <dirent.h>
int traverse_dir(char *path, int level, int (*callback)(struct dirent *, int))
{
DIR *handle = opendir(path);
int path_len;
@hxmwr
hxmwr / show_binary_and_hex_of_a_number.c
Last active November 14, 2018 08:46
Get a number's binary representation and hex representation
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <regex.h>
#define TOTAL_TYPE_PATTERNS 2
enum number_type{
TYPE_INT,
TYPE_FLOAT,
@hxmwr
hxmwr / gist:4fcfca6b039aa61731741ce390270496
Created October 16, 2018 02:15 — forked from ehuynh/gist:2572398
Start and Stop Jenkins on OSX
# start
sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist
# stop
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
@hxmwr
hxmwr / gist:bcc1193e28b606f003cbb77ccf5333f4
Created June 10, 2017 13:21 — forked from maccath/gist:3981205
Split PDF to individual pages using FPDI and FPDF
<?php
/**
* Split PDF file
*
* <p>Split all of the pages from a larger PDF files into
* single-page PDF files.</p>
*
* @package FPDF required http://www.fpdf.org/
* @package FPDI required http://www.setasign.de/products/pdf-php-solutions/fpdi/
@hxmwr
hxmwr / response_now.php
Last active June 4, 2017 13:27
php 脚本返回后继续运行
ignore_user_abort(true);
set_time_limit(0);
ob_start();
// do initial processing here
echo $response; // send the response
header('Connection: close');
header('Content-Length: '.ob_get_length());
ob_end_flush();
ob_flush();
box-shadow: 2px 2px 20px rgba(0,0,0,0.5);
-webkit-box-shadow: 2px 2px 20px rgba(0,0,0,0.5);
-moz-box-shadow: 2px 2px 20px rgba(0,0,0,0.5);