Skip to content

Instantly share code, notes, and snippets.

View imanabu's full-sized avatar

Manabu Tokunaga imanabu

View GitHub Profile
@imanabu
imanabu / ConnectionStrings.config
Last active August 29, 2015 14:11
Visual Studio Snips
<connectionStrings>
<add name="myConnectionString" connectionString="Data Source=HOST\INSTANCE;Initial Catalog=myDB;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
@imanabu
imanabu / Python SHA Hash File
Last active August 29, 2015 14:15
Python Gist
import hashlib
def hashfile(afile, hasher, blocksize=65536):
buf = afile.read(blocksize)
while len(buf) > 0:
hasher.update(buf)
buf = afile.read(blocksize)
return hasher.digest()
[(fname, hashfile(open(fname, 'rb'), hashlib.sha256())) for fname in fnamelst]
@imanabu
imanabu / cflags.sh
Last active August 29, 2015 14:17
MacOS: Show ~/Library on Open Dialog Bix
chflags nohidden ~/Library
@imanabu
imanabu / start-storescp.bat
Created March 16, 2015 20:55
DCMTK Commands I Use
REM Run DCMTK StoreSCP in promisucus mode
storescp -pm -od c:\temp 104
@imanabu
imanabu / tsconfig.json
Created August 16, 2015 14:25
Angularjs 2.0 TypeScript Configurations tsconfig.json
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"module": "commonjs",
"declaration": false,
"noImplicitAny": false,
"removeComments": true,
"noLib": false
@imanabu
imanabu / python3-http-server-8000.sh
Created August 16, 2015 14:30
Angularjs 2.0 Starting a Test SimpleHTTPServer with Python 3
#!/bin/sh
# python3 -m http.server --help
python3 -m http.server 8000
@imanabu
imanabu / WebStormAngularJS2TypescriptCommandLineOptions.txt
Created August 18, 2015 03:10
WebStorm AngularJS2 Typescript Command Line Options
--watch -m commonjs -t es5 --emitDecoratorMetadata --experimentalDecorators
@imanabu
imanabu / ClassAndInstanceInheritance.ts
Created March 4, 2019 22:48
Do Not Confuse Class and Instance Inheritance With TypeScript
/**
* Combined class and instance inheritance in TypeScript
* This looks deceptively simple, but there are two layers of inheritance that's happening
* One is the Class inheritance. Another is the actual instance inheritance that's chained
* through the children array. The parent has its' instance based factory to generate its
* own children either daughters of sons
*/
class person {
constructor(name, parent = null) {
this.name = name;
@imanabu
imanabu / MacThreadDump.md
Last active August 9, 2019 22:17
MacOS Taking App Thread Dump from Terminal
  1. Browse to the /Applications/.app/Contents/MacOS/ executable in Finder,
  2. In the context menu choose Open With, Terminal.
  3. To get a thread dump press Ctrl+\ in the Terminal window.
@imanabu
imanabu / classLoaderDemo.java
Last active August 9, 2019 22:19
Read a Java8 Reousrce File and then Parse into String in 3 lines
ClassLoader classLoader = getClass().getClassLoader();
String fn = classLoader.getResource("some-file.txt").getFile();
String txt = new String(Files.readAllBytes(Paths.get(fn.substring(1)))); // Skips the first / of /c:/ in Windows