This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SMBPasswordLastSet=$(dscl . read /Users/"$USER" SMBPasswordLastSet | awk '{print $NF}') | |
pwdLastSet=$((($SMBPasswordLastSet / 10000000) - 11644473600)) | |
pwdExpire=$(($pwdLastSet + (60 * 60 * 24 * 180))) | |
now=$(date +%s) | |
expiresIn=$((($pwdExpire - $now) / (60 * 60 * 24))) | |
if [ $expiresIn -le 14 ]; then | |
pwdLastSetHuman=$(date -j -f "%s" "$pwdLastSet" "+%d.%m.%Y") | |
pwdExpireHuman=$(date -j -f "%s" "$pwdExpire" "+%d.%m.%Y") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function git_upload_ssh_key () { | |
read -p "Enter github email : " email | |
echo "Using email $email" | |
if [ ! -f ~/.ssh/id_rsa ]; then | |
ssh-keygen -t rsa -b 4096 -C "$email" | |
ssh-add ~/.ssh/id_rsa | |
fi | |
pub=`cat ~/.ssh/id_rsa.pub` | |
read -p "Enter github username: " githubuser | |
echo "Using username $githubuser" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# shortform git commands | |
alias g='git' | |
# print your list of commits this month for a repo | |
git log --since='last month' --author="$(git config user.name)" --oneline | |
# pull in remote changes for the current repository and all its submodules | |
git pull; git submodule foreach git pull origin master | |
# get a list of all commit messages for a repo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias git-gone-l='git fetch --prune && (git branch -v | grep gone) | awk "{print \$1}"' | |
alias git-gone-D='git-gone-l | xargs git branch -D' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cask 'ian4hu-clipy-beta' do | |
version '1.2.9.beta11' | |
sha256 '8ef7220063b847a6ac40ae982c3dd8ac0cfd4ee6b626fea94ec99ce232b5c30e' | |
url "https://github.com/ian4hu/Clipy/releases/download/#{version}/Clipy.app.zip" | |
appcast 'https://raw.githubusercontent.com/ian4hu/Clipy/develop/appcast.xml' | |
name 'ian4hu/Clipy-beta' | |
homepage 'https://github.com/ian4hu/Clipy' | |
app 'Clipy.app' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local user="%{$fg_bold[blue]%}%n@%{$fg_bold[blue]%}%m%{$reset_color%}" | |
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )" | |
PROMPT='${user} ${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)' | |
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗" | |
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function git-rn() { | |
OLD_NAME="$(git branch | grep \* | cut -d ' ' -f2)" | |
NEW_NAME="$1" | |
echo $OLD_NAME | |
echo $NEW_NAME | |
git branch -m $NEW_NAME | |
git branch -a | |
git push origin :$OLD_NAME $NEW_NAME |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require("axios"); | |
exports.endpoint = (request, response) => { | |
if (request.method === "POST") { | |
console.log("POST"); | |
var body = ""; | |
var requestData = {}; | |
request.on("data", async data => { | |
body += data; | |
const req = JSON.parse(body); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Fragment} from "react"; | |
import { render } from "react-dom"; | |
import useMergeState from "./useMergeState"; | |
function App() { | |
const [state, setState] = useMergeState({ a: 1, b: 0 }); | |
return ( | |
<Fragment> | |
<div onClick={() => setState({ a: state.a + 1 })}>A</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const composeEventHandlers = (...fns) => (event, ...args) => | |
fns.some(fn => { | |
fn && fn(event, ...args); | |
return event.defaultPrevented; | |
}); | |
export default composeEventHandlers; |