Skip to content

Instantly share code, notes, and snippets.

@gesquive
gesquive / zero.zsh-theme
Created June 4, 2022 22:13
zero zsh theme
# zero.zsh-theme
# forked from af-magic
# https://github.com/andyfleming/oh-my-zsh/blob/master/themes/af-magic.zsh-theme
# color vars
eval sys_color='$FG[240]'
eval dirty_color='$FG[214]'
eval virt_color='$FG[023]'
eval git_color='$FG[064]'
eval prompt_color='$FG[032]'
@gesquive
gesquive / vscode_golang_launch.json
Last active March 27, 2022 23:15
vs code golang debug launch examples file
{
"version": "0.2.0",
"configurations": [
{
"name": "Golang: App",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceFolder}",
"args": [
#!/bin/sh
# original src: https://unix.stackexchange.com/a/2146/17806
# usage: authkeys-report <authorized_keys-file>
set -ue
tmp="$(mktemp -t fingerprint-authkeys.XXXXXXXX)"
trap 'rm -f "$tmp"' 0
@gesquive
gesquive / vscode_python_launch.json
Last active March 27, 2022 18:23
vs code python debug launch examples file
"configurations": [
{
"name": "Python: Server",
"type": "python",
"request": "launch",
"envFile": "${workspaceFolder}/.env",
"program": "${workspaceFolder}/server.py"
},
{
"name": "Python: run file",
package main
import (
"fmt"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
func main() {
@gesquive
gesquive / cmd.go
Created April 27, 2017 21:48
Run an external command with golang
// run a command using the shell; no need to split args
// from https://stackoverflow.com/questions/6182369/exec-a-shell-command-in-go
func runcmd(cmd string, shell bool) []byte {
if shell {
out, err := exec.Command("bash", "-c", cmd).Output()
if err != nil {
log.Fatal(err)
panic("some error found")
}
return out

Keybase proof

I hereby claim:

  • I am gesquive on github.
  • I am gesquivel (https://keybase.io/gesquivel) on keybase.
  • I have a public key ASB9AOb3ILKZj7j51Ya6YNtREiujK6jd3qlBW4H3wur5Qgo

To claim this, I am signing this object:

@gesquive
gesquive / get_keypress.py
Last active October 29, 2022 09:02
Get keypress for different platforms
#!/usr/bin/env python3
# get_keypress.py
import sys
import os
def main():
try:
print("press ctrl+c to exit")
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@gesquive
gesquive / what-is-my-ip.json
Created March 22, 2015 20:05
Text based external IP locators
[
"http://whatismyip.akamai.com/",
"http://icanhazip.com",
"http://wtfismyip.com/text",
"http://whatsmyip.me/",
"http://api.ipify.org/",
"http://ip.catnapgames.com",
"http://ip.ryansanden.com",
]