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
sudo swapon --show | |
sudo fallocate -l 1G /swapfile | |
sudo dd if=/dev/zero of=/swapfile bs=1024 count=1048576 | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
sudo echo "/swapfile swap swap defaults 0 0" >> /etc/fstab | |
sudo swapon --show |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# iptable command to set DSCP flag on outgoing udp packets | |
iptables -t mangle -A OUTPUT -p udp -j DSCP --set-dscp-class ef |
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
var ffmpeg = require('ffmpeg.js/ffmpeg-mp4.js') | |
document.querySelector('button').addEventListener('click', (evt) => { | |
document.querySelector('[camera]').setAttribute('animation', { | |
property: 'rotation', | |
to: '0 360 0', | |
dur: 10000, | |
easing: 'linear' | |
}) |
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 jsonMiddleware = json({ limit: "10mb", inflate: true }); | |
app.use((req,res,next)=>{ | |
jsonMiddleware(req,res,(err)=>{ | |
if(err){ | |
console.log(err); | |
res.status(400).json({ | |
status: 400, | |
message: "Invalid JSON or request too large" | |
}); | |
} else{ |
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
function getUserMediaPermission() { | |
return new Promise((resolve,reject) => { | |
navigator.mediaDevices.getUserMedia({ video: true, audio: true }) | |
.then(stream => { stream.getTracks().forEach(t => t.stop()); resolve(true) }) | |
.catch(() => { resolve(false) }); | |
}); | |
} | |
// usage | |
getUserMediaPermission().then((granted) => { console.log(granted) }); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="js/jquery-1.10.2.min.js"></script> | |
<!-- be careful to include the parameter "libraries=places" --> | |
<script type="text/javascript" src='http://maps.google.com/maps/api/js?sensor=false&libraries=places'></script> | |
<script src="js/locationpicker.jquery.js"></script> | |
</head> | |
<body> | |
<div id="somecomponent" style="width: 500px; height: 400px;"></div> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script | |
src="https://code.jquery.com/jquery-3.1.1.min.js" | |
integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" | |
crossorigin="anonymous"></script> | |
<script src='https://maps.googleapis.com/maps/api/js?v=3.exp'></script> | |
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
using System; | |
using System.IO; | |
using System.IO.Compression; | |
using System.Text; | |
class Program { | |
private static string Compress(string text) | |
{ | |
byte[] buffer = Encoding.UTF8.GetBytes(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
package foo.foo.foo.foo; | |
import android.content.Intent; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.view.View; | |
public class MainActivity extends AppCompatActivity { | |
@Override |
NewerOlder