Skip to content

Instantly share code, notes, and snippets.

View NaniteFactory's full-sized avatar
😊
Hi

NaniteFactory

😊
Hi
View GitHub Profile
@cuixin
cuixin / json_to_map.go
Created October 25, 2017 01:53
json to map[string]interface{} example in golang
package main
import (
"encoding/json"
"fmt"
)
func dumpMap(space string, m map[string]interface{}) {
for k, v := range m {
if mv, ok := v.(map[string]interface{}); ok {
@Talv
Talv / list.py
Last active April 30, 2023 23:12
sc2 maps cache list
#!/usr/bin/python
import re
import glob
from mpyq import MPQArchive
# CACHE_DIR = '/home/kk/.wine/drive_c/users/Public/Application Data/Blizzard Entertainment/Battle.net/Cache'
CACHE_DIR = 'C:\ProgramData\Blizzard Entertainment\Battle.net\Cache'
class SC2Map(object):
@mattheworiordan
mattheworiordan / restart.sh
Created August 19, 2017 13:23
Heroku scheduled restarts
#!/bin/sh
# Set up the Heroku scheduler to run this command every hour. See example setup at https://goo.gl/nMCSH3
#
# Requires env vars to be set in Heroku with `heroku config:set`:
# - HEROKU_APP_NAME: this is just the app name in Heroku, i.e. `heroku apps` will list all apps you have access to
# - HEROKU_CLI_USER: Once Heroku CLI is authenticated (https://goo.gl/Qypr4x), check `cat .netrc` (or `_netrc` on Windows),
# look for `login` under `machine api.heroku.com`
# - HEROKU_CLI_TOKEN: As above, but use the `password` field
#
@flaviocopes
flaviocopes / check-substring-ends-with.go
Last active November 15, 2021 09:34
Go: check if a string ends with a substring #golang
package main
import (
"strings"
)
func main() {
strings.HasSuffix("foobar", "bar") // true
}
@ninanung
ninanung / forMe2.md
Last active September 21, 2024 01:52
사실은 내가 보기위한 마크다운 문법설명서 - 2. 리스트와 인용구

2.리스트와 인용구(BlockQuote)

2-1.리스트

리스트는 점점 작은 부분을 설명할 때 사용합니다. 예를 들면

1.사람의 몸
1-1.머리
1-1-1.뇌
뇌는 말랑말랑하다. 그러하다
1-2.다리

@Necroforger
Necroforger / embed.go
Last active April 6, 2024 02:22
Needs a fallthrough
//Embed ...
type Embed struct {
*discordgo.MessageEmbed
}
// Constants for message embed character limits
const (
EmbedLimitTitle = 256
EmbedLimitDescription = 2048
EmbedLimitFieldValue = 1024
@ThunderCls
ThunderCls / visual_studio_dark_theme.ini
Last active July 28, 2024 18:25
Visual Studio Dark Theme by ThunderCls (http://i.imgur.com/auzFPxf.png)
[Colors]
AbstractTableViewBackgroundColor=#252526
AbstractTableViewHeaderTextColor=#000000
AbstractTableViewSelectionColor=#323238
AbstractTableViewSeparatorColor=#64646F
AbstractTableViewTextColor=#E8EADE
DisassemblyAddressBackgroundColor=#XXXXXX
DisassemblyAddressColor=#BD63C5
DisassemblyAutoCommentBackgroundColor=#XXXXXX
DisassemblyAutoCommentColor=#787878
@arxdsilva
arxdsilva / working_directory.go
Last active February 12, 2024 13:30
How to get the current working directory in golang
package main
// More info on Getwd()
// https://golang.org/src/os/getwd.go
//
import(
"os"
"fmt"
"log"
)
@evalphobia
evalphobia / README.md
Last active February 22, 2024 18:28
Golang Benchmark: gob vs json

tl;dr

  • JSON is faster for small size data
    • map (key size < 50 and Unmarshalling intensive workload)
    • single struct
  • gob is faster for big size data
    • map (key size > 50 or Marshalling intensive workload)
    • slice

(old) about

package lpcwstr
// #include <windows.h>
// #include <wchar.h>
// #include <WinNT.h>
import "C"
import (
"unicode/utf16"
"unsafe"