Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am snipsnipsnip on github.
  • I am snipsnipsnip (https://keybase.io/snipsnipsnip) on keybase.
  • I have a public key ASBtfx30sf4UHCm1Pzws-X8nQCm4Idw9qV9N6NTfLGrchgo

To claim this, I am signing this object:

@snipsnipsnip
snipsnipsnip / example.hex
Last active February 7, 2024 02:35
intel_hex_record.rb: intel hex record parser
:10006000000102030405060708090A0B0C0D0E0F18
:10007000101112131415161718191A1B1C1D1E1F08
:10008000202122000000000000000000000000000D
:100090000000000000000000000000000000000060
:1000A0000000000000000000000000000000000050
:1000B0000000000000000000000000000000000040
:1000C0000000000000000000000000000000000030
:1000D0000000000000000000000000000000002000
:00000001FF
@snipsnipsnip
snipsnipsnip / rwgetc.c
Last active May 11, 2022 00:17
int rwgetc(SDL_RWops *rw)
/* fgetc equivalent for SDL_rwops */
int rwgetc(SDL_RWops *rw)
{
char c;
return SDL_RWread(rw, &c, 1, 1) == 1 ? c : EOF;
}
/* fgets equivalent for SDL_rwops */
@snipsnipsnip
snipsnipsnip / eclipse-format.xml
Last active January 2, 2022 02:10
C#-like eclipse code format settings
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="11">
<profile kind="CodeFormatterProfile" name="C#-like" version="11">
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="next_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
@snipsnipsnip
snipsnipsnip / update-onamae-ddns.rb
Last active September 18, 2021 03:58
update-onamae-ddns.rb: お名前.comのダイナミックDNSの登録を更新
require 'socket'
require 'openssl'
abort "usage: #$0 userid password {'*'|''|subdomain} example.com" if ARGV.size != 4
UserID, Password, Subdomain, Domain = ARGV
OnamaePubkey = '224ad8a1d3af62ad5638091d485d7d9bf400e5d106ed0d5bdb1d96bb0ee6d2a5'
DDNSServer = 'ddnsclient.onamae.com'
#!/usr/bin/python
import sys
import datetime
# Calculates death probabilities based on Social Security
# actuarial tables for a given group of people.
# Run with a list of ages/genders and an optional timespan (or year in the future):
# python actuary.py 63m 80m 75f 73m 10
@snipsnipsnip
snipsnipsnip / pd+nd.sh
Last active May 30, 2020 01:50
cd to previous directory / next directory
alias pd='cd "../$(ls .. | grep -B1 $(basename $(pwd)) | head -1)"'
alias nd='cd "../$(ls .. | grep -A1 $(basename $(pwd)) | tail -1)"'
@snipsnipsnip
snipsnipsnip / file5.txt
Last active May 14, 2020 10:34
git rebase --interactive でコミットの見分けがつかない問題の対策 ref: https://qiita.com/snipsnipsnip/items/8e4244b4fff2a5a2bc32
$ git reset --hard E # git reset --hard origin/devel でも可
$ git cherry-pick -n D A
$ git commit -m "DとA"
$ git cherry-pick B
$ git cherry-pick C
@snipsnipsnip
snipsnipsnip / chrome-i18n.js
Last active January 11, 2020 11:37 — forked from eligrey/chrome-i18n.js
Easy i18n for your Chrome extensions and apps' DOM.
/*
* A cut-down i18n utility. @snipsnipsnip
* Based on Chrome DOM i18n By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
"use strict";
for (let e of document.querySelectorAll("[data-i18n]")) {
@snipsnipsnip
snipsnipsnip / ants.exe
Last active December 19, 2019 20:30
ants.hsp