This file contains 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
/* | |
Melody | |
Plays a melody upon hitting PIR detection. | |
circuit: | |
* 8-ohm speaker on digital pin 8 | |
created 21 Jan 2010 | |
modified 30 Aug 2011 |
This file contains 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
/* | |
Usage: | |
start with: | |
node --experimental-repl-await interactive_sequelize.js | |
Then we get the REPL shell | |
> | |
> await Product.findAll(); |
This file contains 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
/** | |
Call the code in inspector console | |
*/ | |
function ConnectButton(){ | |
console.log("Connect pushed"); | |
document.querySelector("#top-toolbar > colab-connect-button").shadowRoot.querySelector("#connect").click() | |
} | |
setInterval(ConnectButton,60000); |
This file contains 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 threading | |
terminate_app = false | |
def suicide_callback(): | |
global terminate_app | |
time_name = datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S-%f") | |
print('start', time_name) |
This file contains 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 itertools import islice | |
class MyObject: | |
def __init__(self, text): | |
self.text = text | |
def text(self): | |
return self.text | |
default_empty = type('obj', (object,), {'text': ''}) |
This file contains 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 typing import TypedDict, List | |
class StatsT(TypedDict): | |
""" | |
Type that represents the stats | |
""" | |
total_sentences: int | |
total_chars: int |
This file contains 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
# Reference: | |
https://2019.www.torproject.org/docs/debian.html.en | |
# Add Tor PPA for Ubuntu | |
```bash | |
echo ' | |
deb https://deb.torproject.org/torproject.org bionic main \ | |
deb-src https://deb.torproject.org/torproject.org bionic main \ | |
' >> /etc/apt/sources.list.d/tor |
This file contains 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 items = Array.from({ length: Number(10) }, (x, i) => | |
String(i + 1) | |
.padStart(5, '0')); |
This file contains 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
class MyViewSet( | |
lib_mixins.MultiSerializersMixin, | |
viewsets.ModelViewSet): | |
queryset = models.MyModel.objects.all() | |
serializer_class = serializers.DefaultMyModelSerializer | |
serializer_classes = { | |
'retrieve': serializers.ItemMyModelSerializer, | |
'list': serializers.DefaultMyModelSerializer, | |
'create': serializers.CreateMyModelSerializer, | |
} |
This file contains 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 socket = io.connect(location.protocol + '//' + document.domain + ':' + location.port + namespace); | |
socket.on('connect', function () { | |
socket.on('some response', function(msg) { | |
// do something, like change color, add the text somewheres | |
}); | |
}); |
NewerOlder