Skip to content

Instantly share code, notes, and snippets.

View song940's full-sized avatar
👨‍💻
Typing ...

Lsong song940

👨‍💻
Typing ...
View GitHub Profile
@riyazpanjwani
riyazpanjwani / snake_game.py
Created September 2, 2017 23:01
Simple implementation of Snake game in python
import curses
from curses import KEY_RIGHT, KEY_LEFT, KEY_DOWN, KEY_UP
from random import randint
WIDTH = 120
HEIGHT = 30
MAX_X = WIDTH - 2
MAX_Y = HEIGHT - 2
SNAKE_LENGTH = 5
function shuffle(a) {
for (let i = a.length; i; i--) {
let j = Math.floor(Math.random() * i);
[a[i - 1], a[j]] = [a[j], a[i - 1]];
}
}
@codeif
codeif / unzip.py
Created April 20, 2017 18:04
unzip.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
解决mac下解压zip文件乱码问题
代码参考:
http://stackoverflow.com/questions/9431918/extracting-zip-file-contents-to-specific-directory-in-python-2-7
http://www.zhihu.com/question/20523036/answer/35225920
http://stackoverflow.com/questions/4917284/extract-files-from-zip-without-keeping-the-structure-using-python-zipfile
编码: https://docs.python.org/2.4/lib/standard-encodings.html
@denji
denji / README.md
Last active May 16, 2024 10:38 — forked from Cubixmeister/README.md
Simple Sentry docker-compose.yml
  1. Download docker-compose.yml to dir named sentry
  2. Change SENTRY_SECRET_KEY to random 32 char string
  3. Run docker-compose up -d
  4. Run docker-compose exec sentry sentry upgrade to setup database and create admin user
  5. (Optional) Run docker-compose exec sentry pip install sentry-slack if you want slack plugin, it can be done later
  6. Run docker-compose restart sentry
  7. Sentry is now running on public port 9000
@matl33t
matl33t / terminal_productivity.md
Created February 9, 2017 23:22
saving time on the command-line

Terminal Productivity Tricks

Line Editing Motions

  • [C-a] beginning of the line
  • [C-e] end of the line
  • [C-b] back one character
  • [C-f] forward one character
  • [A-b] back one word (Configure alt to +ESC in iterm profile)
  • [A-f] forward one word
@pepsin
pepsin / merger.rb
Last active March 17, 2017 08:57
Simple CMB CSV Merger and Organizer script
#If you don't have colorize gem, do install it via 'gem install colorize'
#Update
#Add cache categories function
require 'csv'
require 'readline'
require 'colorize'
require 'json'
CACHED_CATEGORIES_FILE = "cache_categories.json"
cache_categories = JSON.parse(File.open(CACHED_CATEGORIES_FILE).read) rescue {}
#!/bin/bash
################################
# OS X Install ISO Creater #
# #
# Author: shela #
################################
#######################################
# Declarations
@song940
song940 / app.js
Last active August 28, 2018 05:46
微信小程序 wx.request 封装
App({
/**
* [request description]
* @param {[type]} method [description]
* @param {[type]} url [description]
* @param {[type]} data [description]
* @param {[type]} header [description]
* @return {[type]} [description]
*/
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active June 13, 2024 22:01
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@mcandre
mcandre / apple-bluetooth-keyboard-windows-10-bootcamp.md
Created June 14, 2016 18:12
How to fix Apple Bluetooth Wireless Keyboard (Windows 10)

The driver situation with Apple Bluetooth wireless keyboards and Windows 10 is horrible, even with the latest BootCamp drivers. Fortunately, a workaround is available, if you're patient.

Pair keyboard once

  1. Turn on the keyboard.
  2. Press and hold Command + w until the keyboard light begins blinking, indicating the keyboard is ready to pair.
  3. Use Windows Bluetooth settings to pair the keyboard, entering the same code (e.g. 123456 Enter) on both internal and external keyboards.

Pairing the keyboard is very trial and error. 9/10 times, Windows will complain that the keyboard is not available for pairing. Just keep trying.