Skip to content

Instantly share code, notes, and snippets.

View crmne's full-sized avatar
👋

Carmine Paolino crmne

👋
View GitHub Profile
@crmne
crmne / gencpuusage.c
Created December 29, 2009 14:32
Generate arbitrary CPU usage
/* Generate arbitrary CPU usage */
#include <stdlib.h>
#include <unistd.h>
#include <err.h>
#include <math.h>
#include <sys/time.h>
#include <stdarg.h>
#include <sys/wait.h>
#define CPUUSAGE 0.2 /* set it to a 0 < float < 1 */
@crmne
crmne / download_zeal_user_docsets.py
Last active June 6, 2022 08:37
A solution to the lack of UI for Dash's user docsets in Zeal. Uses Python 3 and easygui (pip3 install easygui)
"""Download Dash User Docsets and install them in Zeal"""
import configparser
import json
import tarfile
import urllib.request
from pathlib import Path
from sys import platform
import easygui
@crmne
crmne / occupancy_tracker.ino
Created December 6, 2020 13:45
An Arduino Based occupancy tracker with 2 buttons and a display
#include <LiquidCrystal.h>
#define MAX_SEATS 19
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
const int redButton = 7, greenButton = 6;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
int n_occupied = 0;
byte redButtonState = 0, greenButtonState = 0, prevGreenButtonState = 0, prevRedButtonState = 0;
@crmne
crmne / type_clipboard_contents.ahk
Last active July 31, 2020 10:33
When pasting is disabled... what if you could just type the contents of your clipboard?
; Save this script and run it.
; Win+Shift+v will type the contents of your clipboard
#+v::SendRaw, %Clipboard%
diff --git a/tensorflow/core/kernels/concat_lib_gpu_impl.cu.cc b/tensorflow/core/kernels/concat_lib_gpu_impl.cu.cc
index 0f7adaf24a..355584456b 100644
--- a/tensorflow/core/kernels/concat_lib_gpu_impl.cu.cc
+++ b/tensorflow/core/kernels/concat_lib_gpu_impl.cu.cc
@@ -69,7 +69,7 @@ __global__ void concat_variable_kernel(
IntType num_inputs = input_ptr_data.size;
// verbose declaration needed due to template
- extern __shared__ __align__(sizeof(T)) unsigned char smem[];
+ extern __shared__ unsigned char smem[];
@crmne
crmne / Google Translate.scpt
Last active May 15, 2018 18:06
UPDATE: I made a LaunchBar 6 action that you can find here: http://static.paolino.me/GoogleTranslate.lbaction.zip. Make sure to enable Accessibility for LaunchBar, and "Allow Javascript from Apple Events" in Safari's Develop menu. -- Translates text using Google Translate in Safari. It gracefully handles large text, which is impossible with just…
on safari_is_ready(docNum, interval)
repeat
tell application "Safari"
try
do JavaScript "document.readyState" in document docNum
set readyState to result
set finishedLoading to (source of document docNum contains "</html>")
if finishedLoading and readyState is "Complete" then exit repeat
end try
end tell
@crmne
crmne / Convert Currency.scpt
Last active April 13, 2018 10:47
Converts currencies using Google Finance. Created specifically for LaunchBar, just put it in `~/Library/Application Support/LaunchBar/Actions`. It accepts input in this form: `<amount> <from currency> […] <to currency>`. So for example all of those strings will result in the same conversion: "60 gbp to eur" "60 gbp in eur" "60 gbp eur". It will …
on parse_input_string(theString)
set AppleScript's text item delimiters to " "
set theFromAmount to text item 1 of theString as text
if length of text items of theString is greater than 1 then
set theFromCurrency to text item 2 of theString as text
set theToCurrency to text item -1 of theString as text
set currenciesGiven to true
else
set theFromCurrency to "USD"
set theToCurrency to "EUR"
$ ./configure
You have bazel 0.7.0-homebrew installed.
Please specify the location of python. [Default is /usr/bin/python]: /usr/local/bin/python3
Found possible Python library paths:
/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
Please input the desired Python library path to use. Default is [/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages]
Do you wish to build TensorFlow with Google Cloud Platform support? [Y/n]:
@crmne
crmne / SafariPowerSaverWhitelister.scpt
Created May 12, 2014 11:02
A tool to add websites to Safari Power Saver's whitelist.
on number_to_string(this_number)
set this_number to this_number as string
if this_number contains "E+" then
set x to the offset of "," in this_number
set y to the offset of "+" in this_number
set z to the offset of "E" in this_number
set the decimal_adjust to characters (y - (length of this_number)) thru ¬
-1 of this_number as string as number
if x is not 0 then
set the first_part to characters 1 thru (x - 1) of this_number as string
- repo: git://github.com/pre-commit/pre-commit-hooks
sha: master
hooks:
- id: trailing-whitespace
- id: autopep8-wrapper
- id: check-added-large-files
- id: check-ast
language_version: python3.4
- id: check-case-conflict
- id: check-docstring-first