This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <regex> | |
| #include <fstream> | |
| #include <string> | |
| using namespace std; | |
| int main() { | |
| std::ifstream ifs("sample.in"); | |
| std::string var((std::istreambuf_iterator<char>(ifs)), | |
| (std::istreambuf_iterator<char>())); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // See the comment for flashing instruction. | |
| #include <ESP8266WiFi.h> | |
| #define ONBOARD_LED 16 | |
| #define ESP8266_LED 2 | |
| // ADC_MODE(ADC_VCC); will result in compile error. use this instead. | |
| int __get_adc_mode(void) { return (int) (ADC_VCC); } | |
| void setup() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # dotfiles utility - https://gist.github.com/Jamesits/9bc4adfb1f299380c79e | |
| # Set $DOTFILES to where you want to put your dotfiles. | |
| # then run dotfiles-init someSoftware, | |
| # and it will move all files starting with `.someSoftware` to the correct location | |
| # then link them back, | |
| # Which will produce a directory structure like: | |
| # | |
| # $ tree -aL 2 ~/Dropbox/Code/config/dotfiles/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| update() { | |
| case $1 in | |
| # apt-get | |
| apt) | |
| apt update && apt full-upgrade -y | |
| ;; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # 8 Queens Problem | |
| # by James Swineson | |
| from functools import reduce | |
| # 一个棋盘的表示,其中 .board[i] 表示第 i 行的旗子在第几列 | |
| class nQueenBoard: | |
| def __init__(self, size, board=[]): | |
| self.size = size |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| int main(void) | |
| { | |
| // input arguments (assuming n, k > 0) | |
| int n, k; | |
| scanf("%d%d", &n, &k); | |
| // initialize number -> position mapping array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| by James Swineson, 2016-06-30 | |
| Apply to: URL starts with http://www.jjwxc.net/onebook.php?novelid= | |
| */ | |
| body { | |
| background: moccasin !important; | |
| } | |
| body>div { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Public Domain | |
| # (someone claimed the next lines would be useful for… | |
| # people. So here goes: © 2012 Stefan Breunig | |
| # [email protected]) | |
| # modified by James Swineson <[email protected]> | |
| # interfaces | |
| interfaces=(enp1s0 wlp2s0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # by @Jamesits 2016-08-23 | |
| # Great thanks to @m13253 | |
| def dec_unicode_decode(s): | |
| return ''.join((bytes([x&255, x>>8]).decode('utf-16-le') for x in map(int, s.split('#')[1:]))) | |
| def dec_unicode_encode(s): | |
| return '#' + '#'.join([str(int(x, 16)) for x in str(s.encode("unicode-escape"))[2:-1].split("\\\\u")[1:]]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # for Ubuntu | |
| sudo apt-get install build-essential libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev libjansson-dev libpython-dev make | |
| git clone https://github.com/vysheng/tg.git --recursive | |
| cd tg | |
| ./configure | |
| make |