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
<div class="container"> | |
<span class="label" id="cost-label">Cost($):</span><span class="value" id="cost">0</span> | |
<span class="label" id="margin-label">Margin(%):</span><span class="value" id="margin">0</span> | |
<span class="label" id="markup-label">Markup(%):</span><span class="value" id="markup">0</span> | |
<span class="label" id="revenue-label">Revenue($):</span><span class="value" id="revenue">0</span> | |
<span class="label" id="profit-label">Profit($):</span><span class="value" id="profit">0</span> | |
<button class="btn silver clear">C</button> |
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
#!/usr/bin/env python | |
import sys | |
import argparse | |
import urllib | |
# import urlparse | |
import base64 | |
import mimetypes | |
import html | |
import sqlite3 |
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
APP=TeamsFixer | |
mkdir -vp ${APP}.app/Contents/MacOS ${APP}.app/Contents/Resources | |
PATH="$PATH:/usr/libexec" | |
printf '#!/usr/bin/env bash\nexec /Applications/Microsoft\ Teams.app/Contents/MacOS/Teams --disable-gpu' > ${APP}.app/Contents/MacOS/${APP} | |
chmod +x ${APP}.app/Contents/MacOS/${APP} | |
cp /Applications/Microsoft\ Teams.app/Contents/Resources/icon.icns ${APP}.app/Contents/Resources/icon.icns | |
PlistBuddy ${APP}.app/Contents/Info.plist -c "add CFBundleDisplayName string ${APP}" | |
PlistBuddy ${APP}.app/Contents/Info.plist -c "add CFBundleIconFile string icon.icns" | |
PlistBuddy ${APP}.app/Contents/version.plist -c "add ProjectName string ${APP}" | |
find ${APP}.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
#!/bin/bash | |
mkdir ./cgi-bin/ | |
cp upload.cgi ./cgi-bin/ | |
chmod +x ./cgi-bin/upload.cgi | |
mkdir ./upload/ | |
python -m CGIHTTPServer 8080 |
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 androidx.lifecycle.LiveData | |
import androidx.lifecycle.MediatorLiveData | |
import kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.Job | |
import kotlinx.coroutines.delay | |
import kotlinx.coroutines.launch | |
fun <T> LiveData<T>.debounce(duration: Long = 1000L, coroutineScope: CoroutineScope) = MediatorLiveData<T>().also { mld -> | |
val source = this |
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
// https://stackoverflow.com/a/60985346 | |
private static String uniqueID = null; | |
private static final String PREF_UNIQUE_ID = "PREF_UNIQUE_ID"; | |
public synchronized static String id(Context context) { | |
if (uniqueID == null) { | |
SharedPreferences sharedPrefs = context.getSharedPreferences( | |
PREF_UNIQUE_ID, Context.MODE_PRIVATE); | |
uniqueID = sharedPrefs.getString(PREF_UNIQUE_ID, null); | |
if (uniqueID == null) { | |
uniqueID = UUID.randomUUID().toString(); |
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
Context context = view.getContext(); | |
ContentResolver cr = context.getContentResolver(); | |
ContentValues values; | |
try { | |
// create a file for test | |
File file = new File(context.getFilesDir(), "1234568"); | |
file.createNewFile(); | |
try (OutputStream os = new FileOutputStream(file)) { | |
os.write("test".getBytes()); |
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
def getVersionCode(){ | |
try { | |
def (major, minor, patch) = getVersionName().split('-')[0].tokenize('.') | |
(major, minor, patch) = [major, minor, patch].collect{it.toInteger()} | |
return (major * 1000000) + (minor * 10000) + (patch * 100) | |
} | |
catch (ignored) { | |
return -1; | |
} | |
} |
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
from pprint import pprint | |
import re | |
import json | |
def parse_records(records: str): | |
# see if we have any complete entries | |
beg = records.index(" # Host name") | |
end = records.rindex("============================================================================================") | |
if (beg > 0 and end > 0): |
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 | |
#sudo port install opensc | |
#sudo port install curl | |
#sudo port install libp11 | |
export OPENSSL_CONF=$(mktemp) | |
cat << EOF > $OPENSSL_CONF | |
openssl_conf = openssl_init | |
[openssl_init] |
OlderNewer