- copy your image (
Ctrl+AandCtrl+C) - make a new document-sized pure-black layer behind it
- group the black layer and yor image together
- add mask to the group
- enter mask edit mode (
alt+clickon the mask icon/thumbnail) - paste your image in the mask (b/w) and then invert it.
- save it as a 24-bit transparent PNG
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
| name: Build LaTeX document | |
| on: [push] | |
| jobs: | |
| build_latex: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Set up Git repository | |
| uses: actions/checkout@v2 | |
| - name: Compile LaTeX document | |
| uses: xu-cheng/latex-action@v2 |
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/awk -f | |
| # This program is a copy of guff, a plot device. https://github.com/silentbicycle/guff | |
| # My copy here is written in awk instead of C, has no compelling benefit. | |
| # Public domain. @thingskatedid | |
| # Run as awk -v x=xyz ... or env variables for stuff? | |
| # Assumptions: the data is evenly spaced along the x-axis | |
| # TODO: moving average |
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 useMedia(query) { | |
| const [matches, setMatches] = useState(window.matchMedia(query).matches) | |
| useEffect(() => { | |
| const media = window.matchMedia(query) | |
| if (media.matches !== matches) { | |
| setMatches(media.matches) | |
| } | |
| const listener = () => { | |
| setMatches(media.matches) |
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
| <?xml version="1.0" encoding="utf-8"?> | |
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1016" android:versionName="1.0.2" android:compileSdkVersion="29" android:compileSdkVersionCodename="10" package="no.simula.smittestopp" platformBuildVersionCode="29" platformBuildVersionName="10"> | |
| <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29"/> | |
| <uses-feature android:name="android.hardware.bluetooth_le" android:required="false"/> | |
| <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> | |
| <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/> | |
| <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> | |
| <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/> | |
| <uses-permission android:name="android.permission.INTERNET"/> | |
| <uses-permission android:name="android.permission.BLUETOOTH"/> |
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 requests | |
| import re | |
| import sys | |
| from multiprocessing.dummy import Pool | |
| def robots(host): | |
| r = requests.get( | |
| 'https://web.archive.org/cdx/search/cdx\ | |
| ?url=%s/robots.txt&output=json&fl=timestamp,original&filter=statuscode:200&collapse=digest' % host) |
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
| #include "SPI.h" | |
| #include <Wire.h> | |
| #include <TimeLib.h> | |
| #include <DS1307RTC.h> | |
| const int cathode_pins[] = {2, 3, 4, 5, 6, 7, 8, 9, 14, 15, 16, 17}; // カソードに接続するArduinoのピン | |
| const int number_of_cathode_pins = sizeof(cathode_pins) / sizeof(cathode_pins[0]); | |
| int numbers_to_display = 0; // LEDに表示する数字を保持する変数 | |
| int numbers_to_display_low = 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
| // === Arrays | |
| var [a, b] = [1, 2]; | |
| console.log(a, b); | |
| //=> 1 2 | |
| // Use from functions, only select from pattern | |
| var foo = () => [1, 2, 3]; |
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"
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
| <?php | |
| function time2str($ts) { | |
| if(!ctype_digit($ts)) { | |
| $ts = strtotime($ts); | |
| } | |
| $diff = time() - $ts; | |
| if($diff == 0) { | |
| return 'now'; | |
| } elseif($diff > 0) { | |
| $day_diff = floor($diff / 86400); |
NewerOlder